package com.cap6402.project.two;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Random;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.Facebook;

import android.app.Application;

public class Utility extends Application {

    public static Facebook mFacebook;
    public static AsyncFacebookRunner mAsyncRunner;
    public static JSONObject mFriendsList;
    public static String userID = null;
    public static String name = null;
    public static HashMap<String, String> currentPermissions = new HashMap<String, String>();
    public static final String APP_ID = "308034925924021";
    public static final int LOAD_GAME_DIALOG = 0;
    public static final int LOAD_LEVELS_DIALOG = 1;
    public static final int HIGH_SCORE_LIST = 3;
    public static LinkedHashMap<String,LinkedHashMap<String,Integer>> levelScores = new LinkedHashMap<String,LinkedHashMap<String,Integer>>();
    
	public static JSONArray shuffle(JSONArray jsonArray) throws JSONException {
		Random random = new Random();
		for(int i = jsonArray.length()-1; i >= 0; i--) {
			int j = random.nextInt(i+1);
			
			Object object = jsonArray.get(j);
			jsonArray.put(j,jsonArray.get(i));
			jsonArray.put(i,object);
		}
		
		return jsonArray;
	}

}
